<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript" src="js/vue.js"></script>
</head>
<body>
    <div id="app">

        <input type="text" @keyup.20="an">
        <p>{{text}}</p>
    </div>
    
</body>

<script>

    vm = new Vue({
        el: '#app',
        data:{
            text:"",
            bool:false
        },
        methods:{
            an(){
                this.bool = !this.bool
                if(this.bool){
                    this.text = '当前已切换大写模式！'
                }else{
                    this.text = ''
                }
            }
        }
    })

</script>
</html>